# -*- coding: utf-8 -*- # 
import wx
import data
from SortedList import SortedList
class BookListPanel(wx.Panel, SortedList):
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, -1)
        SortedList.__init__(self, parent)
    
        self.load()

    
    def init(self):

        box = wx.BoxSizer(wx.VERTICAL)
    

        self.list = self.createlist( data.get("bookTableTitles")
        )
        box.Add(self.list, 1, wx.EXPAND|wx.LEFT|wx.RIGHT, 2)

        self.SetSizer(box)
        self.SetAutoLayout(True)

    def initdata(self):
        datas = {}
        for i in range(100):
            datas[i] = ('', i, '书名%02d' % i, '作者%03d' % i,'备注%04d' % i)
        return datas
    
    def load(self):
        number = self.loaddata()
        self.SortListItems(col=1)

